<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>09-v-bind&v-on使用案例</title>
  <style>
    .active {
      color: red
    }
  </style>
</head>
<body>

  <div id="app">
    <ul>
      <li v-for="(item, index) in list" :class="{active: curentIndex === index}" @click="liClick(index)">{{item}}</li>
    </ul>
  </div>

  <script src="./js/vue.js"></script>
  <script>
    const app = new Vue({
      el: "#app",
      methods:{
        liClick(index) {
          this.curentIndex = index
        }
      },
      data: {
        list: [
          "JavaScrit 权威指南",
          "你不知道的JavaScrit（上卷）",
          "你不知道的JavaScrit（中卷）",
          "你不知道的JavaScrit（下卷）",
          "ES6 学习指南",
          "Vue 学习教程"
        ],
        curentIndex: 0
      }
    })
  </script>
</body>
</html>